package cci.jdbc;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class ConnectionJavaDB {
	private static DataSource datasource;

	public static DataSource getInstance() {
		if (datasource == null) {
			Context initCtx;
			try {
				initCtx = new InitialContext();
				datasource = (DataSource) initCtx
						.lookup("java:comp/env/jdbc/Domo");
			} catch (NamingException e) {
				throw new RuntimeException(e);
			}
		}
		return datasource;
	}
}
